package cn.maihe.elg.operation.centers.guogu.exception;

import cn.maihe.elg.operation.centers.guogu.enums.GuoGuRespCodeEnum;

/**
 * @Description
 * @Author SSX
 * @Date 2025/03/18
 */
public class GuoGuException extends RuntimeException {

    private GuoGuRespCodeEnum statusEnum;
    private String message;

    public GuoGuException(GuoGuRespCodeEnum statusEnum, String message, Throwable cause) {
        super(message, cause);
        this.statusEnum = statusEnum;
        this.message = message;
    }

    public static GuoGuException of(GuoGuRespCodeEnum statusEnum, String message) {
        return new GuoGuException(statusEnum, message, null);
    }

    public static GuoGuException of(GuoGuRespCodeEnum statusEnum, String message, Throwable cause) {
        return new GuoGuException(statusEnum, message, cause);
    }

    public static GuoGuException error(String message, Throwable... cause) {
        return new GuoGuException(GuoGuRespCodeEnum.FAILURE, message, cause!=null&&cause.length>0?cause[0]:null);
    }

    public GuoGuRespCodeEnum getStatusEnum() {
        return statusEnum;
    }

    @Override
    public String getMessage() {
        return message;

    }

}
